﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace OrderManagementAPI.Models
{
    public class Order
    {
        [Key]
        public int OrderId { get; set; }

        [Required]
        public string Customer { get; set; }

        public List<OrderDetail> Details { get; set; } = new();

        [NotMapped]
        public decimal TotalAmount => Details.Sum(d => d.Subtotal);
    }
}
